#include <iostream>
#include <vector>
#include <list>

using namespace std;

int main(void)
{
	list<int> list1;

	for(int i=0; i<8; i++)
	{
		list1.push_back(i);
	}

	for(list<int>::iterator it = list1.begin(); it != list1.end(); ++it)
	{
		if(*it%2 == 0)
		{
			it = list1.erase(it); // get next element location
			it--; // go back to last location
		}
	}

	for(list<int>::iterator it = list1.begin(); it != list1.end(); ++it)
	{
		cout << *it << endl;
	}

	return 0;
}
